#pragma once

#include <string>

#include "../Main.h"

class Item {
	public:
		string name;
		SDL_Surface* image;
		
	public:
		Item(string name = "", string id = "") {
			this->name = name;
			if (id != "") {
				this->image = LoadBMP(("img/inventory/" + id + ".bmp").c_str(), 0xFF, 0, 0xFF);
				if (!this->image)
					DebugMessage("Item", "Item", "Can't load item file!", error);
			} else {
				this->image = 0;
			}
		}
		
		Item(const Item& a)  {
			this->name = a.name;
			if (a.image)
				this->image = SDL_ConvertSurface(a.image, a.image->format, a.image->flags);
			else
				this->image = 0;
		}
		
		~Item() {
			//FIXME: Tu coś nie gra
			//if (image)
				//SDL_FreeSurface(image);
		}
};

class Weapon : public Item {
	public:
		unsigned short attack;
	
		Weapon(string name = "", string id = "", int attack = 0) : Item(name, id) {
			this->attack = attack;
		}
		
		Weapon(const Weapon& a) : Item(a)  {
			this->attack = a.attack;
		}
};

class Armor : public Item {
	public:
		unsigned short defense;
	
		Armor(string name = "", string id = "", int defense = 0) : Item(name, id) {
			this->defense = defense;
		}
		
		Armor(const Armor& a) : Item(a)  {
			this->defense = a.defense;
		}
};